﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Odds.DBUtility;
using System.Data.SqlClient;
using Odds.Entity;

namespace Odds.DataAccess
{
    public class OddsSPController
    {
        public List<OddsBeginAndEndCount> GetIssueOddsBeginAndEndRecordCountByIssueIDWithAdjust(string issueRealId, decimal adjust, int matchType)
        {
            return OddsSQLEntityHelper<OddsBeginAndEndCount>.GetEntitySet(CommandType.StoredProcedure,
                "Pro_GetIssueOddsBeginAndEndRecordCountByIssueIDWithAdjust",
                new SqlParameter[3]
                { 
                    new SqlParameter("@issueRealID",issueRealId),
                    new SqlParameter("@adjust", adjust),
                    new SqlParameter("@matchType", matchType)
                });
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="issueRealId"></param>
        /// <param name="adjust"></param>
        /// <param name="matchType">0:all, 1:league, 2:champion</param>
        /// <returns></returns>
        public List<OddsBeginOrEndCount> GetIssueOddsBeginOrEndRecordCountByIssueIDWithAdjust(string issueRealId, decimal adjust, int matchType)
        {
            //string strMatchType = string.Empty;
            //if (matchType == 1)
            //{
            //    strMatchType = "杯";
            //}
            //else
            //{
                
            //}
            return OddsSQLEntityHelper<OddsBeginOrEndCount>.GetEntitySet(CommandType.StoredProcedure,
                "Pro_GetIssueOddsBeginOrEndRecordCountByIssueIDWithAdjust",
                new SqlParameter[3]
                { 
                    new SqlParameter("@issueRealID",issueRealId),
                    new SqlParameter("@adjust", adjust),
                    new SqlParameter("@matchType", matchType)
                });
        }


        public List<Pro_TrendOf310Result> GetTrendOf310()
        {
            List<Pro_TrendOf310Result> result = new List<Pro_TrendOf310Result>();
            using (OddsRecorderContextWrapper context = new OddsRecorderContextWrapper())
            {
                result = context.Pro_TrendOf310().ToList();
            }
            return result;
        }



        public List<Pro_TrendOfResultSumResult> GetTrendOfResultSum()
        {
            List<Pro_TrendOfResultSumResult> result = new List<Pro_TrendOfResultSumResult>();
            using (OddsRecorderContextWrapper context = new OddsRecorderContextWrapper())
            {
                result = context.Pro_TrendOfResultSum().ToList();
            }
            return result;
        }

        public List<Pro_TrendOfOddsBeginSummaryResult> GetTrendOfOddsBeginSummary(string oddsCompanyID)
        {
            List<Pro_TrendOfOddsBeginSummaryResult> result = new List<Pro_TrendOfOddsBeginSummaryResult>();
            using (OddsRecorderContextWrapper context = new OddsRecorderContextWrapper())
            {
                result = context.Pro_TrendOfOddsBeginSummary(oddsCompanyID).ToList();
            }
            return result;
        }
    }
}
